#ifndef CONTACTLISTVIEW_H
#define CONTACTLISTVIEW_H
#include "customevent.h"
#include <QTableView>
#include <QLabel>

namespace gloox
{
    class MessageSession;
}

class ContactItem;
class QSortFilterProxyModel;
class ContactTableModel;
class ContactItemDelegate;
class ChatWindow;

class ContactListView : public QTableView
{
    Q_OBJECT
public:
    explicit ContactListView(QWidget *parent = 0);
    ~ContactListView();
signals:
//    void selectionChanged(const QItemSelection &);
//    void doubleClicked ( const QModelIndex & index );

public slots:
    void onDoubleClicked ( const QModelIndex & index );

protected:
    DECLARE_CUSTOM_EVENT()
    void onLogin();
    void onLogoff(int errorCode);
    void onContactInfo(ContactItem& contact);
    void onContactInfos(std::vector<ContactItem>& contacts);
    void onMessageSession(gloox::MessageSession* session);
    void onCloseChatWindow(ChatWindow& window);


private:
    ContactTableModel *table;
    ContactItemDelegate *item;
    QSortFilterProxyModel *proxyModel;
    QList< ChatWindow > chatWindowList;

};

#endif // CONTACTLISTVIEW_H
